list = ['Michael', 'Bob', 'Tracy']


def get():
    '''如何获取list中元素'''
    print(len(list))
    print(list[0])
    print(list[2])

    print(list[-1])
    print(list[-3])


def change():
    '''如何对list中的元素增加，删除，更新'''
    list.append('Adam')
    print(list)
    list.insert(1, 'Jack')
    print(list)

    list.pop()
    print(list)
    list.pop(2)
    print(list)

    list[1] = 'Alice'
    print(list)


def list_type():
    '''list中的元素类型可以不一样'''
    L = ['Apple', 123, True]
    list.append(L)
    print(list)


def test_tuple():
    classmates = ('Michael', 'Bob', 'Tracy')
    print(len(classmates))
    print(classmates[1])


def get_mid(list):
    f = len(list) // 2
    if len(list) % 2 == 0:
        print([list[f - 1], list[f]])
    else:
        print(list[f])


# get()
change()
# list_type()
# test_tuple()
# get_mid([1232, 233, 123, 1234, 5356])
print(list)
